<!DOCTYPE html>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <script src="//cdn.bootcss.com/angular.js/1.5.8/angular.min.js"></script>
</head>
<body>

<div ng-app="myApp" ng-controller="userController">

    <ul>
        <li ng-repeat="user in users">
            <span>  {{ user.id + ', ' + user.name +','+user.age }}</span>
            <button ng-click="ageAdd(user.id)">增加</button>
        </li>
    </ul>

</div>

<script>
    var app = angular.module('myApp', []);
    app.controller('userController', function ($scope, $http) {
        $http.get("http://localhost:8080/userRest/all")
                .success(function (response) {
                    $scope.users = response;
                });

        $scope.ageAdd=function (id) {
         for (var i=0;i<$scope.users.length;i++){
                if($scope.users[i].id==id){
                    $scope.users[i].age++;
                }
            }
        }
    });
</script>

</body>
</html>
